public WebApiResult <object> AddUpdateReturnsTemplate(ReturnTemplate objReturnTemp)
 {
     try
     {
         if (objReturnTemp.ReturnTemplateId > 0)
         {
             var dbReturnsTemplate = GetReturnTemplate(objReturnTemp.ReturnTemplateId);
             dbReturnsTemplate.UpdateFrom(objReturnTemp);
             Context.Entry(dbReturnsTemplate).OriginalValues["RowVersion"] = objReturnTemp.RowVersion;
             Context.SaveChanges();
             return(WebApiResult <object> .New(null, dbReturnsTemplate.GetVersionJson()));
         }
         else
         {
             try
             {
                 Context.ReturnTemplate.Add(objReturnTemp);
                 Context.SaveChanges();
             }
             catch (Exception ex)
             {
                 throw;
             }
             return(WebApiResult <object> .New(null, objReturnTemp.GetVersionJson()));
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
示例#2
0
        public virtual void Write(ICodeFragment fragment, IOutputCache output)
        {
            ReturnTemplate template = (ReturnTemplate)fragment;

            output.Add("return ")
            .Add(template.Code)
            .CloseLine();
        }