public ResponseResult <bool> Edit([FromBody] GroupInfoEditDto model)
 {
     return(_groupInfoService.Update(model).Success());
 }
Beispiel #2
0
        public ActionResult UpdateSelectedGroup(string GroupName, int GroupID, int GroupTypeId)
        {
            using (var transaction = new TransactionScope())
            {
                try
                {
                    RBACUser rUser = new RBACUser(Session["UserName"].ToString());
                    if (!rUser.HasPermission("Group_Update"))
                    {
                        return(Json("X", JsonRequestBehavior.AllowGet));
                    }

                    if (GroupTypeId == 1)
                    {
                        GroupInfo GgName = new GroupInfo();
                        var       data   = _groupinfoService.All().ToList().FirstOrDefault(x => x.GroupID == GroupID);
                        if (data != null)
                        {
                            //Misclns.CopyPropertiesTo(OpnBal, UpOpnBal);

                            data.GroupName = GroupName;
                            _groupinfoService.Update(data);
                            _groupinfoService.Save();

                            transaction.Complete();
                        }
                        var ecode = 1;
                        return(Json(ecode, JsonRequestBehavior.AllowGet));
                    }
                    else if (GroupTypeId == 2)
                    {
                        SGroupInfo GgName = new SGroupInfo();
                        var        data   = _sgroupinfoService.All().ToList().FirstOrDefault(x => x.SGroupID == GroupID);
                        if (data != null)
                        {
                            //Misclns.CopyPropertiesTo(OpnBal, UpOpnBal);

                            data.SGroupName = GroupName;
                            _sgroupinfoService.Update(data);
                            _sgroupinfoService.Save();

                            transaction.Complete();
                        }
                        var ecode = 1;
                        return(Json(ecode, JsonRequestBehavior.AllowGet));
                    }
                    else if (GroupTypeId == 3)
                    {
                        SSGroupInfo GgName = new SSGroupInfo();
                        var         data   = _ssgroupinfoService.All().ToList().FirstOrDefault(x => x.SSGroupID == GroupID);
                        if (data != null)
                        {
                            //Misclns.CopyPropertiesTo(OpnBal, UpOpnBal);

                            data.SSGroupName = GroupName;
                            _ssgroupinfoService.Update(data);
                            _ssgroupinfoService.Save();

                            transaction.Complete();
                        }
                        var ecode = 1;
                        return(Json(ecode, JsonRequestBehavior.AllowGet));
                    }

                    return(Json(JsonRequestBehavior.AllowGet));
                }
                catch (Exception ex)
                {
                    transaction.Dispose();
                    return(Json("0", JsonRequestBehavior.AllowGet));
                }
            }
        }