Validate Model Data Using DataAnnotations Attributes no working in mvc
using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.ComponentModel;

using System.ComponentModel.DataAnnotations;

using System.Web.Mvc;


namespace MvcCustomer.Models

{
       
 public class CustomerInfo

       {
           [Required(ErrorMessage = "FirstName is Required")]
           [DisplayName("FirstName")]
           [StringLength(160)]
           public object FirstName { get; set; }

           [Required(ErrorMessage = "LastName is required")]
           [DisplayName("LastName")]
           [StringLength(160)]
           public object LastName { get; set; }

           [Required(ErrorMessage = "Phone is required")]
           [DisplayName("Phone")]
           [StringLength(24)]
           public object Phone { get; set; }

       }
    }


//CustomerInfo controller


 [HttpGet]

        public ActionResult Create()
        {
            return View();

        }

        [HttpPost]


        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Create(CustomerInfo customerinfo)
        {
            
            
                try
                {

                    BLL.Customer customer = new BLL.Customer();
                    customer.CreateCustomer(customerinfo);

                    return RedirectToAction("Index");

                }
                catch
                {
                    return View();
                }
Validate Model Data Using DataAnnotations Attributes no working in mvc
===

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.ComponentModel;

using System.ComponentModel.DataAnnotations;

using System.Web.Mvc;


namespace MvcCustomer.Models

{
       
 public class CustomerInfo

       {
           [Required(ErrorMessage = "FirstName is Required")]
           [DisplayName("FirstName")]
           [StringLength(160)]
           public object FirstName { get; set; }

           [Required(ErrorMessage = "LastName is required")]
           [DisplayName("LastName")]
           [StringLength(160)]
           public object LastName { get; set; }

           [Required(ErrorMessage = "Phone is required")]
           [DisplayName("Phone")]
           [StringLength(24)]
           public object Phone { get; set; }

       }
    }


//CustomerInfo controller


 [HttpGet]

        public ActionResult Create()
        {
            return View();

        }

        [HttpPost]


        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Create(CustomerInfo customerinfo)
        {
            
            
                try
                {

                    BLL.Customer customer = new BLL.Customer();
                    customer.CreateCustomer(customerinfo);

                    return RedirectToAction("Index");

                }
                catch
                {
                    return View();
                }