public SetOfBook GetSingle(string id, long companyId)
        {
            long longId = Convert.ToInt64(id);

            SetOfBook sob = this.Context.SetOfBooks.FirstOrDefault(x => x.CompanyId == companyId && x.Id == longId);

            return(sob);
        }
Ejemplo n.º 2
0
 public SetOfBookModel(SetOfBook entity)
 {
     if (entity != null)
     {
         this.Id        = entity.Id;
         this.CompanyId = entity.CompanyId;
         this.Name      = entity.Name;
     }
 }
        public string Update(SetOfBook entity)
        {
            var orignalEntity = this.Context.SetOfBooks.Find(entity.Id);

            this.Context.Entry(orignalEntity).CurrentValues.SetValues(entity);
            this.Context.Entry(orignalEntity).State = EntityState.Modified;
            this.Commit();
            return(entity.Id.ToString());
        }
Ejemplo n.º 4
0
        public ActionResult Edit(string id)
        {
            AccountCreateViewModel model = new AccountCreateViewModel(service.GetSingle(id, AuthenticationHelper.User.CompanyId));
            SetOfBook sob = sobService.GetSingle(model.SOBId.ToString(), AuthenticationHelper.User.CompanyId);

            model.SetOfBooks = new List <SelectListItem>();
            model.SetOfBooks.Add(new SelectListItem {
                Text = sob.Name, Value = sob.Id.ToString()
            });

            return(View(model));

            //Opens popup in grid..
        }
Ejemplo n.º 5
0
        public ActionResult Create(SetOfBookModel model)
        {
            if (ModelState.IsValid)
            {
                SetOfBook duplicateRecord = service.GetSetOfBook(AuthenticationHelper.User.CompanyId, model.Name);
                if (duplicateRecord == null)
                {
                    string result = service.Insert(MapModel(model));
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ModelState.AddModelError("Error", "Set of Book Already exists.");
                }
            }

            return(View(model));
        }
 public string Insert(SetOfBook entity)
 {
     this.Context.SetOfBooks.Add(entity);
     this.Commit();
     return(entity.Id.ToString());
 }
        public SetOfBook GetSetOfBook(long companyId, string name)
        {
            SetOfBook sob = this.Context.SetOfBooks.FirstOrDefault(x => x.Name == name && x.CompanyId == companyId);

            return(sob);
        }
Ejemplo n.º 8
0
 public string Update(SetOfBook entity)
 {
     return(this.repository.Update(entity));
 }
Ejemplo n.º 9
0
 public string Insert(SetOfBook entity)
 {
     return(this.repository.Insert(entity));
 }