public async Task <ActionResult> Create(TemplatesType collection) { try { ModelState.Remove("Id"); if (ModelState.IsValid) { if (collection.Id == Guid.Empty) { await APIHelpers.PostAsync <TemplatesType>("api/TemplateType/Post", collection); TempData["sucess"] = TemplateTypeResources.create; } else { await APIHelpers.PutAsync <TemplatesType>("api/TemplateType/Put", collection); TempData["sucess"] = TemplateResources.update; } } return(RedirectToAction("Index")); } catch (Exception ex) { throw; } }
public TemplatesType Put(TemplatesType model) { try { return(_repository.Update(model)); } catch (Exception ex) { throw; } }
public TemplatesType Get(Guid id) { try { TemplatesType data = _repository.GetById(id); return(data); } catch (Exception ex) { throw; } }
public TemplatesType Post(TemplatesType model) { try { model.Id = Guid.NewGuid(); var data = _repository.Insert(model); return(data); } catch (Exception ex) { throw; } }
public JsonResult GetTemplatesForOperations(TemplatesType template) { switch (template) { case TemplatesType.PersAccount: _templateManager = new PersAccTemplateManager(); break; case TemplatesType.Debts: break; case TemplatesType.Invest: break; default: break; } return(Json(_templateManager.ReturnAddOpeartionTemplates(), JsonRequestBehavior.AllowGet)); }