Example #1
0
 public ResponseModel CreateNode(A_GlAccount aObj)
 {
     if (aObj != null)
     {
         A_GlAccount nameEsist = _db.A_GlAccount.FirstOrDefault(x => x.Name == aObj.Name);
         if (nameEsist != null)
         {
             return(_aModel.Respons(false, "Given Name Exists In The Chart Of Account"));
         }
     }
     try
     {
         A_GlAccount aParent = _db.A_GlAccount.FirstOrDefault(x => x.A_GlAccountId == aObj.ParentId);
         if (aParent != null)
         {
             aParent.TransactionAllowed = false;
             _db.A_GlAccount.Attach(aParent);
             _db.Entry(aParent).State = EntityState.Modified;
             aObj.TransactionAllowed  = true;
             aObj.CreatedDate         = DateTime.Now;
             aObj.AccountType         = aParent.AccountType;
             aObj.BalanceType         = aParent.BalanceType;
         }
         aObj.IsActive  = true;
         aObj.IsDeleted = false;
         _db.A_GlAccount.Add(aObj);
         _db.SaveChanges();
         return(_aModel.Respons(true, " Congratulation : A new node created successfully"));
     }
     catch (Exception ex)
     {
         return(_aModel.Respons(false, ex.Message));
     }
 }
Example #2
0
        public JsonResult CreateNode(A_GlAccount aObj)
        {
            var data = _aCOA.CreateNode(aObj);

            return(Json(new { success = data.Status, data }, JsonRequestBehavior.AllowGet));
        }