示例#1
0
 public StatusEnum.Status UpdateEntity(EntityModel model)
 {
     StatusEnum.Status status = StatusEnum.Status.Success;
     try
     {
         PASCore_Entity entityUpdate = _entityRepository.GetByID(model.EntityId);
         entityUpdate.BankDetails      = model.BankDetails;
         entityUpdate.Code             = model.Code;
         entityUpdate.Description      = model.Description;
         entityUpdate.Email            = model.Email;
         entityUpdate.IsDeleted        = false;
         entityUpdate.Line1            = model.Line1;
         entityUpdate.Line2            = model.Line2;
         entityUpdate.Name             = model.Name;
         entityUpdate.PhoneNumber      = model.PhoneNumber;
         entityUpdate.ModifiedDateTime = DateTime.UtcNow;
         _entityRepository.Update(entityUpdate);
         _entityRepository.SaveChanges();
     }
     catch (Exception)
     {
         status = StatusEnum.Status.Fail;
         throw;
     }
     return(status);
 }
示例#2
0
        public StatusEnum.Status CreateEntity(EntityModel model)
        {
            StatusEnum.Status status = StatusEnum.Status.Success;
            try
            {
                _entity                 = new PASCore_Entity();
                _entity.BankDetails     = model.BankDetails;
                _entity.Code            = model.Code;
                _entity.Description     = model.Description;
                _entity.Email           = model.Email;
                _entity.IsDeleted       = false;
                _entity.Line1           = model.Line1;
                _entity.Line2           = model.Line2;
                _entity.Name            = model.Name;
                _entity.PhoneNumber     = model.PhoneNumber;
                _entity.CreatedDateTime = DateTime.UtcNow;
                _entityRepository.Create(_entity);
                _entityRepository.SaveChanges();
            }
            catch (Exception)
            {
                status = StatusEnum.Status.Fail;
                throw;
            }

            return(status);
        }
示例#3
0
 public StatusEnum.Status DeleteEntity(int id)
 {
     StatusEnum.Status status = StatusEnum.Status.Success;
     try
     {
         PASCore_Entity entityDelete = _entityRepository.GetByID(id);
         entityDelete.IsDeleted = true;
         _entityRepository.Update(entityDelete);
         _entityRepository.SaveChanges();
     }
     catch (Exception)
     {
         status = StatusEnum.Status.Fail;
         throw;
     }
     return(status);
 }