public bool Update(int userId, int id, ref object dtoItem, out Library.DTO.Notification notification)
        {
            notification      = new Notification();
            notification.Type = NotificationType.Success;
            DTO.DueColorDTO dtoItems = ((Newtonsoft.Json.Linq.JObject)dtoItem).ToObject <DTO.DueColorDTO>();
            try
            {
                using (var context = CreateContext())
                {
                    DueColor dueColor = null;

                    if (id == 0)
                    {
                        dueColor = new DueColor();

                        context.DueColor.Add(dueColor);
                    }
                    else
                    {
                        dueColor = context.DueColor.FirstOrDefault(o => o.DueColorID == id);
                    }

                    if (dueColor == null)
                    {
                        notification.Message = "Due Color not found!";

                        return(false);
                    }
                    else
                    {
                        converter.DTO2BD_DueColor(dtoItems, ref dueColor);
                        context.SaveChanges();

                        dtoItem = GetEditData(dueColor.DueColorID, out notification).Data;

                        return(true);
                    }
                }
            }
            catch (Exception ex)
            {
                notification.Type    = NotificationType.Error;
                notification.Message = ex.Message;

                return(false);
            }
        }
 public void DTO2BD_DueColor(DTO.DueColorDTO dtoItem, ref DueColor dbItem)
 {
     AutoMapper.Mapper.Map <DTO.DueColorDTO, DueColor>(dtoItem, dbItem);
 }