public bool UpdateVillProfile(tbVillageProfile VillProfile) { db.Open(); string sql = "Update [dbo].[tbVillageProfile] "; sql = sql + " set [contituency]=@contituency,[district]=@district,[block]=@block,[village] =@village,[totalVotes]=@totalVotes,[casteMajor]=@casteMajor,[problems]=@problems ,[remarks]=@remarks,[comments]=@comments,[sarpanchID]=@sarpanchID "; sql = sql + " where profileID=@profileID"; var data = new { village = VillProfile.village, district = VillProfile.district, block = VillProfile.block, contituency = VillProfile.contituency, totalVotes = VillProfile.totalVotes, casteMajor = VillProfile.casteMajor, problems = VillProfile.problems, remarks = VillProfile.remarks, sarpanchID = VillProfile.sarpanchID, comments = VillProfile.comments, profileID = VillProfile.profileID }; var Constituency = db.Execute(sql, data); if (Constituency > 0) { return(true); } else { return(false); } }
public bool InsertVillProfile(tbVillageProfile VillProfile) { db.Open(); string sql = "INSERT INTO [dbo].[tbVillageProfile]"; sql = sql + "([contituency],[district],[block],[village] ,[totalVotes],[casteMajor],[problems] ,[remarks],[comments],[sarpanchID]) "; sql = sql + " VALUES(@contituency, @district, @block, @village, @totalVotes, @casteMajor, @problems, @remarks, @comments, @sarpanchID) "; var data = new { village = VillProfile.village, district = VillProfile.district, block = VillProfile.block, contituency = VillProfile.contituency, totalVotes = VillProfile.totalVotes, casteMajor = VillProfile.casteMajor, problems = VillProfile.problems, remarks = VillProfile.remarks, sarpanchID = VillProfile.sarpanchID, comments = VillProfile.comments }; var Constituency = db.Execute(sql, data); if (Constituency > 0) { return(true); } else { return(false); } }
public ActionResult UpdateVillageProfile(tbVillageProfile VillProfile) { VillageProfileRepo villRepo = new VillageProfileRepo(); var result = villRepo.UpdateVillProfile(VillProfile); if (result) { return(Json(new { status = "Success", data = "" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { status = "error", data = "" }, JsonRequestBehavior.AllowGet)); } }