public ActionResult Save(SlsCollectionTarget CollectionTarget)
        {
            int userId = Convert.ToInt32(Session["userId"]);
            int companyId = Convert.ToInt32(Session["companyId"]);
            Operation objOperation = new Operation { Success = false };

            if (ModelState.IsValid)
            {
                if (CollectionTarget.Id == 0)
                {
                    if ((bool)Session["Add"])
                    {
                        CollectionTarget.SecCompanyId = companyId;
                        CollectionTarget.CreatedBy = userId;
                        CollectionTarget.CreatedDate = DateTime.Now.Date;
                        objOperation = _collectionTargetService.Save(CollectionTarget);
                    }
                    else { objOperation.OperationId = -1; }

                }
                else
                {
                   if ((bool)Session["Edit"])
                {
                    CollectionTarget.SecCompanyId = companyId;
                    CollectionTarget.ModifiedBy = userId;
                    CollectionTarget.ModifiedDate = DateTime.Now.Date;
                    objOperation = _collectionTargetService.Update(CollectionTarget);
                }
                   else { objOperation.OperationId = -2; }
                }
            }

            return Json(objOperation, JsonRequestBehavior.DenyGet);
        }
        public Operation Save(SlsCollectionTarget objSlsCollectionTarget)
        {
            Operation objOperation = new Operation { Success = true };

            long Id = _collectionTargetRepository.AddEntity(objSlsCollectionTarget);
            objOperation.OperationId = Id;

            try
            {
                _unitOfWork.Commit();
            }
            catch (Exception ex)
            {
                objOperation.Success = false;
            }
            return objOperation;
        }
        public Operation Update(SlsCollectionTarget objSlsCollectionTarget)
        {
            Operation objOperation = new Operation { Success = true, OperationId = objSlsCollectionTarget.Id };
            _collectionTargetRepository.Update(objSlsCollectionTarget);

            try
            {
                _unitOfWork.Commit();
            }
            catch (Exception)
            {
                objOperation.Success = false;

            }
            return objOperation;
        }