示例#1
0
        public void Delete(St_OtherAccount ObjDelete)
        {
            var ObjToDelete = _context.St_OtherAccounts.SingleOrDefault(m => m.CompanyID == ObjDelete.CompanyID);

            if (ObjToDelete != null)
            {
                _context.St_OtherAccounts.Remove(ObjToDelete);
            }
        }
示例#2
0
        public JsonResult SaveSt_OtherAccount(St_OtherAccount ObjToSave)
        {
            MsgUnit Msg = new MsgUnit();

            try
            {
                var userId   = User.Identity.GetUserId();
                var UserInfo = _unitOfWork.User.GetMyInfo(userId);
                ObjToSave.InsDateTime = DateTime.Now;
                ObjToSave.InsUserID   = userId;
                ObjToSave.CompanyID   = UserInfo.fCompanyId;
                if (!ModelState.IsValid)
                {
                    string Err    = " ";
                    var    errors = ModelState.Values.SelectMany(v => v.Errors);
                    foreach (ModelError error in errors)
                    {
                        Err = Err + error.ErrorMessage + " * ";
                    }

                    Msg.Msg  = Resources.Resource.SomthingWentWrong + " : " + Err;
                    Msg.Code = 0;
                    return(Json(Msg, JsonRequestBehavior.AllowGet));
                }
                _unitOfWork.St_OtherAccount.Delete(ObjToSave);
                _unitOfWork.St_OtherAccount.Add(ObjToSave);
                _unitOfWork.Complete();
                Msg.Code = 1;
                Msg.Msg  = Resources.Resource.AddedSuccessfully;
                return(Json(Msg, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                Msg.Msg  = Resources.Resource.SomthingWentWrong + " : " + ex.Message.ToString();
                Msg.Code = 0;
                return(Json(Msg, JsonRequestBehavior.AllowGet));
            }
        }
示例#3
0
 public void Add(St_OtherAccount ObjSave)
 {
     _context.St_OtherAccounts.Add(ObjSave);
 }