public ActionResult SaveArtikl(ArtiklEntity artikl) { bool isSaved = false; DataAccessAdapterBase adapter = Helper.GetDataAccessAdapter(User.Identity.Name); using (adapter) { adapter.StartTransaction(System.Data.IsolationLevel.Serializable, "SaveArtikl"); ArtiklEntity artikl4Save; if (artikl.ArtiklId == 0) { artikl4Save = artikl; artikl4Save.IsActive = true; artikl4Save.FirmaId = UserEntity.GetFirmaId(adapter, User.Identity.Name); } else { artikl4Save = ArtiklEntity.FetchArtikl(adapter, null, artikl.ArtiklId); artikl4Save.UpdateDataFromOtherObject(artikl, null, null); } isSaved = adapter.SaveEntity(artikl4Save); adapter.Commit(); } dynamic response = new { IsSaved = isSaved }; return(CreateJsonResponse(response)); }
public ActionResult GetArtikl(long artiklId) { using (DataAccessAdapterBase adapter = Helper.GetDataAccessAdapter()) { ArtiklEntity artikl = ArtiklEntity.FetchArtikl(adapter, null, artiklId); return(CreateJsonResponse(artikl)); } }
public ActionResult GetArtiklCollection() { DataAccessAdapterBase adapter = Helper.GetDataAccessAdapter(User.Identity.Name); using (adapter) { long firmaId = UserEntity.GetFirmaId(adapter, User.Identity.Name); IEnumerable <ArtiklEntity> artiklCollection = ArtiklEntity.FetchActiveArtiklCollection(adapter, firmaId).OrderBy(a => a.Naziv); return(CreateJsonResponse(artiklCollection)); } }
protected override void SetDataSource(DataAccessAdapterBase adapter, RelationPredicateBucket bucket, int pageNumber, int pageSize, string sortField, bool isSortAscending) { PrefetchPath2 prefetchPath = new PrefetchPath2(EntityType.ArtiklEntity); prefetchPath.Add(ArtiklEntity.PrefetchPathPdv); this.DataSource = ArtiklEntity.FetchArtiklCollectionForPaging(adapter, bucket, prefetchPath, pageNumber, pageSize, sortField, isSortAscending); this.NoOfRecords = ArtiklEntity.GetNumberOfEntities(adapter, bucket); }