示例#1
0
        public ActionResult UpdateRigChecklist(RigOapChecklist model)
        {
            // TODO: Add update logic here
            var response = RigOapChecklistClient.UpdateRigChecklistAsync(model).Result;

            return(RedirectToAction("Index"));
        }
示例#2
0
        public static RigOapChecklist UpdateChecklist(RigOapChecklistClient client, RigOapChecklist checklist, GridRouteTypes type, int originalHasCode, string gridErrorKey, ViewDataDictionary viewData)
        {
            if (client == null)
            {
                viewData[gridErrorKey] = "Rig Oap client is null. Refresh Page and try again. Contact system administrator if the error persists";
                return(checklist);
            }
            var currentHashCode = checklist.GetHashCode();

            if (currentHashCode != originalHasCode)
            {
                try
                {
                    switch (type)
                    {
                    case GridRouteTypes.Add:
                    case GridRouteTypes.Update:
                    case GridRouteTypes.Delete:
                        var updateResponse = client.UpdateRigChecklistAsync(checklist).Result;

                        if (updateResponse.Result.Errors.Any())
                        {
                            DisplayGridErrors(updateResponse.Result.Errors, gridErrorKey, viewData);
                        }
                        else
                        {
                            checklist = updateResponse.Result.Data;
                        }

                        break;
                    }
                }
                catch (Exception ex)
                {
                    viewData[gridErrorKey] = ex.Message;
                }

                return(checklist);
            }

            return(checklist);
        }