Esempio n. 1
0
        public SkUserTypeDTOcs SaveUserTypeSK(SkUserTypeDTOcs dto)
        {
            try
            {
                using (SEDESOLEntities db = new SEDESOLEntities())
                {
                    SOUP_KITCHEN_USER_TYPE ut = db.SOUP_KITCHEN_USER_TYPE.FirstOrDefault(v => v.Id_UserType == dto.Id_UserType && v.Id_SoupKitchen == dto.Id_SoupKitchen);
                    if (ut != null)
                    {
                        dto.Message = "Se ha ingresado previamente.";
                    }
                    else
                    {
                        ut = new SOUP_KITCHEN_USER_TYPE();
                        ut.Id_SoupKitchen = dto.Id_SoupKitchen;
                        ut.Id_UserType    = dto.Id_UserType;
                        ut.IsActive       = true;
                        db.SOUP_KITCHEN_USER_TYPE.Add(ut);

                        if (db.SaveChanges() > 0)
                        {
                            dto.Id      = ut.Id;
                            dto.Message = "SUCCESS";
                        }
                    }
                    return(dto);
                }
            }
            catch (Exception ex)
            {
                return(new SkUserTypeDTOcs());
            }
        }
Esempio n. 2
0
        public JsonResult SaveUserTypeSk(SkUserTypeDTOcs att)
        {
            try
            {
                att.IsActive = true;
                SedesolServiceClient proxy = new SedesolServiceClient();
                att = proxy.SaveUserTypeSK(att);

                List <SkUserTypeDTOcs> list = new List <SkUserTypeDTOcs>();

                if (att.Message == "SUCCESS")
                {
                    list = proxy.GetUserTypeBySKId(att.Id_SoupKitchen);
                    list = list.OrderBy(x => x.UserTypeDto.ApprovalOrder).ToList();
                }

                string viewContent = ConvertViewToString("UserTypeList", list);
                return(Json(new { message = att.Message, PartialView = viewContent }));
            }
            catch (Exception ex)
            {
                return(Json(new { message = "ERROR" }));
            }
        }
Esempio n. 3
0
        public SkUserTypeDTOcs SaveUserTypeSK(SkUserTypeDTOcs dto)
        {
            UserDAO dao = new UserDAO();

            return(dao.SaveUserTypeSK(dto));
        }
Esempio n. 4
0
        public SkUserTypeDTOcs SaveUserTypeSK(SkUserTypeDTOcs dto)
        {
            UserDAL dal = new UserDAL();

            return(dal.SaveUserTypeSK(dto));
        }