コード例 #1
0
        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;
            }
        }
コード例 #2
0
 public TemplatesType Put(TemplatesType model)
 {
     try
     {
         return(_repository.Update(model));
     }
     catch (Exception ex)
     {
         throw;
     }
 }
コード例 #3
0
 public TemplatesType Get(Guid id)
 {
     try
     {
         TemplatesType data = _repository.GetById(id);
         return(data);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
コード例 #4
0
 public TemplatesType Post(TemplatesType model)
 {
     try
     {
         model.Id = Guid.NewGuid();
         var data = _repository.Insert(model);
         return(data);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
コード例 #5
0
        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));
        }