コード例 #1
0
        public override IHttpActionResult Post(Customer model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var isCustomerPhoneExist = _service.IsCustomerPhoneExist(model.Phone, model.Id, ActionType.Post);

            if (isCustomerPhoneExist)
            {
                return(BadRequest("Customer phone no " + model.Phone + " already exist."));
            }

            if (string.IsNullOrWhiteSpace(model.Id))
            {
                model.Id = Guid.NewGuid().ToString();
            }
            if (string.IsNullOrWhiteSpace(model.BranchId))
            {
                model.BranchId = User.Identity.GetBranchId();
            }
            model.Active = true;

            model.Code = _autoGenDataService.GetData(AutoGenType.CustomerCode);
            _service.CreateAsTenant(model);

            //_dailyCustomerAccountBalanceService.Create(entity.Id, entity.Created, entity.OpeningDue, User.Identity.GetUserId());

            return(Ok(model.Id));
        }
コード例 #2
0
 public IHttpActionResult Get(AutoGenType type)
 {
     return(Ok(_service.GetData(type)));
 }