public static void CreateProfile(UserProfileMasterModel model)
 {
     using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(Helper.ConString("DefaultConnection")))
     {
         connection.Execute("if exists(select * from UserProfileMaster where StudentId = @StudentId) begin update UserProfileMaster set FirstName = @FirstName,LastName=@LastName,Gender=@Gender,DOB=@DOB,CollageId=@CollageId,YOG=@YOG where StudentId = @StudentId end else begin insert into UserProfileMaster(StudentId,FirstName,LastName,Gender,DOB,CollageId,YOG) values(@StudentId,@FirstName,@LastName,@Gender,@DOB,@CollageId,@YOG) end ", new { model.StudentId, model.FirstName, model.LastName, model.gender, model.DOB, model.CollageId, model.YOG });
     }
 }
        public ActionResult Create(UserProfileMasterModel model)
        {
            model.StudentId   = UserProfileMasterBAL.GetStudentProfileData(User.Identity.Name).StudentId;
            model.CollageList = CollageMasterBAL.GetCollageList();
            model.GenderList  = UserProfileMasterBAL.BindGender();

            if (ModelState.IsValid)
            {
                UserProfileMasterBAL.CreateProfile(model);
                return(RedirectToAction("Create"));
            }
            else
            {
                return(View(model));
            }
        }