public void UpdatePoliceStation(UpdatePoliceStationViewModel model) { try { if (model != null && model.PoliceStationRowID > 0) { MasterPoliceStation entity = new MasterPoliceStation(); entity.PoliceStationRowID = model.PoliceStationRowID; entity.PoliceStationName = model.PoliceStationName; entity.PoliceStationAddress = model.PoliceStationAddress; entity.CountryRowID = model.CountryRowID; entity.StateRowID = model.StateRowID; entity.DistrictRowID = model.DistrictRowID; entity.LocationRowID = model.LocationRowID; entity.Coverage = model.Coverage; entity.Website = model.Website; entity.ModeOfInitiation = model.ModeOfInitiation; entity.SpecialInstruction = model.SpecialInstruction; entity.MandatoryDocument = model.MandatoryDocument; entity.AdditionalCosting = model.AdditionalCosting; entity.AdditionalCost = model.AdditionalCost; entity.ModeOfPayment = model.ModeOfPayment; entity.ConcernPersonName = model.ConcernPersonName; entity.DesigConcernPerson = model.DesigConcernPerson; entity.OfficialLandlineNo = model.OfficialLandlineNo; entity.OfficialEmailId = model.OfficialEmailId; entity.MobileNo = model.MobileNo; entity.AdditionalComments = model.AdditionalComments; entity.Other1 = model.Other1; entity.Other2 = model.Other2; entity.Other3 = model.Other3; entity.Other4 = model.Other4; entity.Other5 = model.Other5; //entity.VerificationProcessTAT = model.VerificationProcessTAT; entity.FavourOf = model.FavourOf; entity.OtherDocumentDetail = model.OtherDocumentDetail; entity.OtherInitiation = model.OtherInitiation; entity.PayableAT = model.PayableAT; entity.AccountNumber = model.AccountNumber; entity.IFSCCode = model.IFSCCode; entity.VerificationTATLevel1 = model.VerificationTATLevel1; entity.VerificationTATLevel2 = model.VerificationTATLevel2; db.Entry(entity).State = EntityState.Modified; } else { throw new Exception("Police Station could not be blank!"); } } catch (Exception) { throw; } }
public UpdatePoliceStationViewModel GetPoliceStationrForUpdateById(short PoliceStationRowID) { try { UpdatePoliceStationViewModel model = new UpdatePoliceStationViewModel(); var entity = db.MasterPoliceStations.Find(PoliceStationRowID); if (entity != null) { model.PoliceStationRowID = entity.PoliceStationRowID; model.PoliceStationName = entity.PoliceStationName; model.PoliceStationAddress = entity.PoliceStationAddress; model.CountryRowID = entity.CountryRowID; model.StateRowID = entity.StateRowID; model.DistrictRowID = entity.DistrictRowID; model.LocationRowID = entity.LocationRowID; model.Coverage = entity.Coverage; model.Website = entity.Website; model.ModeOfInitiation = entity.ModeOfInitiation; model.SpecialInstruction = entity.SpecialInstruction; model.MandatoryDocument = entity.MandatoryDocument; model.AdditionalCosting = entity.AdditionalCosting; model.AdditionalCost = entity.AdditionalCost; model.ModeOfPayment = entity.ModeOfPayment; model.ConcernPersonName = entity.ConcernPersonName; model.DesigConcernPerson = entity.DesigConcernPerson; model.OfficialLandlineNo = entity.OfficialLandlineNo; model.OfficialEmailId = entity.OfficialEmailId; model.MobileNo = entity.MobileNo; model.AdditionalComments = entity.AdditionalComments; model.Other1 = entity.Other1; model.Other2 = entity.Other2; model.Other3 = entity.Other3; model.Other4 = entity.Other4; model.Other5 = entity.Other5; model.FavourOf = entity.FavourOf; model.OtherDocumentDetail = entity.OtherDocumentDetail; model.OtherInitiation = entity.OtherInitiation; model.PayableAT = entity.PayableAT; model.AccountNumber = entity.AccountNumber; model.IFSCCode = entity.IFSCCode; model.VerificationTATLevel1 = entity.VerificationTATLevel1; model.VerificationTATLevel2 = entity.VerificationTATLevel2; } else { throw new Exception("Invalid Id!"); } return(model); } catch (Exception) { throw; } }