private static GenericResponse UpdatePackList(PackListInformation listinfo) { try { var response = new GenericResponse(); using (var context = new Entities()) { var plist = (from list in context.PackListHeads where list.Id == listinfo.Id select list).FirstOrDefault(); if (plist == null) { var list = new PackListHead(); Mapper.Map(listinfo, list); context.PackListHeads.AddObject(list); } else { Mapper.Map(listinfo, plist); } context.SaveChanges(); } response.Success = true; return(response); } catch (Exception ex) { LoggingMediator.Log("UpdatePack"); LoggingMediator.Log(ex); return(new GenericResponse { Success = false, FailureInformation = "Error in PAPService:UpdatePackList" }); } }
private static GenericResponse UpdatePackList(PackListInformation listinfo) { try { var response = new GenericResponse(); using (var context = new Entities()) { var plist = (from list in context.PackListHeads where list.Id == listinfo.Id select list).FirstOrDefault(); if (plist == null) { var list = new PackListHead(); Mapper.Map(listinfo, list); context.PackListHeads.AddObject(list); } else Mapper.Map(listinfo, plist); context.SaveChanges(); } response.Success = true; return response; } catch (Exception ex) { LoggingMediator.Log("UpdatePack"); LoggingMediator.Log(ex); return new GenericResponse {Success = false, FailureInformation = "Error in PAPService:UpdatePackList"}; } }