public void UpdateStatus(DTO.LABURNUM.COM.AlbumModel model) { if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password)) { new FrontEndApi.AlbumApi().UpdateIsActive(model); } }
public List <DTO.LABURNUM.COM.AlbumModel> SearchAlbumByAdvanceSearch(DTO.LABURNUM.COM.AlbumModel model) { if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password)) { return(new AlbumHelper(new FrontEndApi.AlbumApi().GetAlbumByAdvanceSearch(model)).Map()); } else { return(null); } }
public long Add(DTO.LABURNUM.COM.AlbumModel model) { if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password)) { return(new FrontEndApi.AlbumApi().Add(model)); } else { return(-1); } }
private long AddAlbum(DTO.LABURNUM.COM.AlbumModel model) { API.LABURNUM.COM.Album apiAlbum = new Album() { AlbumName = model.AlbumName, AddedById = model.AddedById, AlbumCoverImage = model.AlbumCoverImage, AlbumDetails = GetApiAlbumDetails(model.AlbumDetails), CreatedOn = new Component.Utility().GetISTDateTime(), IsActive = true }; this._laburnum.Albums.Add(apiAlbum); this._laburnum.SaveChanges(); return(apiAlbum.AlbumId); }
public void UpdateIsActive(DTO.LABURNUM.COM.AlbumModel model) { model.AlbumId.TryValidate(); List <API.LABURNUM.COM.Album> dbAlbums = this._laburnum.Albums.Where(x => x.AlbumId == model.AlbumId && x.IsActive == true).ToList(); if (dbAlbums.Count == 0) { throw new Exception(API.LABURNUM.COM.Component.Constants.ERRORMESSAGES.NO_RECORD_FOUND); } if (dbAlbums.Count > 1) { throw new Exception(API.LABURNUM.COM.Component.Constants.ERRORMESSAGES.MORE_THAN_ONE_RECORDFOUND); } dbAlbums[0].IsActive = model.IsActive; dbAlbums[0].LastUpdated = new Component.Utility().GetISTDateTime(); this._laburnum.SaveChanges(); }
private DTO.LABURNUM.COM.AlbumModel MapCore(API.LABURNUM.COM.Album apiAlbum) { DTO.LABURNUM.COM.AlbumModel dtoClass = new DTO.LABURNUM.COM.AlbumModel() { AlbumId = apiAlbum.AlbumId, AlbumName = apiAlbum.AlbumName, AlbumCoverImage = apiAlbum.AlbumCoverImage, AddedById = apiAlbum.AddedById, UpdatedById = apiAlbum.UpdatedById, UpdatedByName = apiAlbum.UpdatedById != null ? apiAlbum.Faculty1.FacultyName : "", AddedByName = apiAlbum.Faculty.FacultyName, AlbumDetails = new AlbumDetailHelper(apiAlbum.AlbumDetails.Where(x => x.IsActive == true).ToList()).Map(), CreatedOn = apiAlbum.CreatedOn, IsActive = apiAlbum.IsActive, LastUpdated = apiAlbum.LastUpdated }; return(dtoClass); }
public long Add(DTO.LABURNUM.COM.AlbumModel model) { return(AddValidation(model)); }
private long AddValidation(DTO.LABURNUM.COM.AlbumModel model) { model.AlbumName.TryValidate(); model.AddedById.TryValidate(); return(AddAlbum(model)); }
public List <API.LABURNUM.COM.Album> GetAlbumByAdvanceSearch(DTO.LABURNUM.COM.AlbumModel model) { IQueryable <API.LABURNUM.COM.Album> iQuery = null; //Search By Album ID. if (model.AlbumId > 0) { iQuery = this._laburnum.Albums.Where(x => x.AlbumId == model.AlbumId && x.IsActive == true); } //Search By Album Name. if (iQuery != null) { if (model.AlbumName != null) { iQuery = iQuery.Where(x => x.AlbumName.Contains(model.AlbumName) && x.IsActive == true); } } else { if (model.AlbumName != null) { iQuery = this._laburnum.Albums.Where(x => x.AlbumName.Contains(model.AlbumName) && x.IsActive == true); } } //Search By Added By Id. if (iQuery != null) { if (model.AddedById > 0) { iQuery = iQuery.Where(x => x.AddedById == model.AddedById && x.IsActive == true); } } else { if (model.AddedById > 0) { iQuery = this._laburnum.Albums.Where(x => x.AddedById == model.AddedById && x.IsActive == true); } } //Search By Updated By Id. if (iQuery != null) { if (model.UpdatedById > 0) { iQuery = iQuery.Where(x => x.UpdatedById == model.UpdatedById && x.IsActive == true); } } else { if (model.UpdatedById > 0) { iQuery = this._laburnum.Albums.Where(x => x.UpdatedById == model.UpdatedById && x.IsActive == true); } } List <API.LABURNUM.COM.Album> dbAlbums = iQuery.ToList(); return(dbAlbums); }