public string DeleteProfile(LakeProfile item) { string msg = string.Empty; item.ProfileActive = false; try { if (ModelState.IsValid) { _LakeSvc.InactivateProfile(item); msg = "Profile inactivated succesfully"; } else { msg = "Data validation not successfull"; } } catch (Exception e) { msg = "Delete Profile. An error has ocurred"; } return(msg); }
public bool InactivateProfile(LakeProfile item) { bool result = false; try { using (RCID_DWHEntities context = new RCID_DWHEntities()) { Lake_Profile efItem = context.Lake_Profile.Where(b => b.ProfileID == item.ProfileID).FirstOrDefault(); if (efItem == null) { return(result); } efItem.ProfileActive = false; if (context.SaveChanges() > 0) { result = true; } } } catch (Exception) { } return(result); }
public string CreateProfile([Bind(Exclude = "ProfileID")] LakeProfile item) { string msg = string.Empty; try { if (ModelState.IsValid) { _LakeSvc.CreateProfile(item); msg = "Profile created succesfully"; } else { msg = "Data validation not successfull"; } } catch (Exception e) { msg = "Create Profile. An error has ocurred"; } return(msg); }
public string EditProfile(LakeProfile item) { string msg = string.Empty; try { if (ModelState.IsValid) { _LakeSvc.UpdateProfile(item); msg = "Profile saved succesfully"; } else { msg = "Data validation not successfull"; } } catch (Exception e) { msg = "Edit Profile. An error has ocurred"; } return(msg); }
public int CreateProfile(LakeProfile item) { int newid = 0; try { using (RCID_DWHEntities context = new RCID_DWHEntities()) { var lastItem = context.Lake_Profile.OrderByDescending(u => u.ProfileID).FirstOrDefault(); if (lastItem != null) { newid = lastItem.ProfileID; newid++; } Lake_Profile efItem = new Lake_Profile() { ProfileDate = item.ProfileDate, ProfileID = newid, ProfileActive = item.ProfileActive, SourceID = LIMS_SOURCEID, SamplePointID = item.SamplePointID }; context.Lake_Profile.Add(efItem); if (context.SaveChanges() > 0) { return(newid); } } } catch (Exception e) { throw e; } return(newid); }
public bool InactivateProfile(LakeProfile item) { return(_LakeRepo.InactivateProfile(item)); }
public int CreateProfile(LakeProfile item) { return(_LakeRepo.CreateProfile(item)); }
public bool UpdateProfile(LakeProfile item) { return(_LakeRepo.UpdateProfile(item)); }