Пример #1
0
        public IHttpActionResult Update(Uom uom)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                var IsNotDuplicate = _uomService.Update(uom);
                if (IsNotDuplicate == true)
                {
                    Log.Info($"{typeof(UomController).FullName}||{UserEnvironment}||Update record successful.");
                    return(Content(HttpStatusCode.OK, "Uom updated successfully"));
                }
                else
                {
                    Log.Info($"{typeof(UomController).FullName}||{UserEnvironment}||Update record not successful, Uom Code is duplicate.");
                    return(Content(HttpStatusCode.Forbidden, "Uom Code is Duplicate"));
                }
            }
            catch (Exception ex)
            {
                return(Content(HttpStatusCode.BadRequest, ex.Message));
            }
        }
Пример #2
0
 public JavaScriptResult Edit(UomViewModel uOMvm)
 {
     try
     {
         _uomService.Update(Mapper.Map <Uom>(uOMvm));
         return(JavaScript($"ShowResult('{"Data saved successfully."}','{"success"}','{"redirect"}','{"/APanel/UOM"}')"));
     }
     catch (Exception ex)
     {
         return(JavaScript($"ShowResult('{ex.Message}','failure')"));
     }
 }