예제 #1
0
        public async Task <RepoResponse <bool> > UpdateAsync(CheckDupAddSql model, int updateBy)
        {
            var pars = GetParams(model, ignoreKey: new string[]
            {
                nameof(model.CreatedBy),
                nameof(model.CreatedTime),
                nameof(model.UpdatedTime),
                nameof(model.UpdatedBy),
            });

            pars.Add(nameof(model.UpdatedBy), updateBy);
            try
            {
                using (var con = GetConnection())
                {
                    await con.ExecuteAsync("sp_UpdateCustomer_v2", pars, commandType : CommandType.StoredProcedure);

                    return(RepoResponse <bool> .Create(true));
                }
            }
            catch (Exception e)
            {
                return(RepoResponse <bool> .Create(false, GetException(e)));
            }
        }
예제 #2
0
        public async Task <RepoResponse <int> > CreateAsync(CheckDupAddSql model, int createdBy)
        {
            try
            {
                using (var con = GetConnection())
                {
                    var pars = GetParams(model, nameof(model.Id), ignoreKey: new string[] {
                        nameof(model.CreatedTime),
                        nameof(model.UpdatedTime),
                        nameof(model.UpdatedBy),
                        nameof(model.CreatedBy)
                    });
                    pars.Add("CreatedBy", createdBy);

                    await con.ExecuteAsync("sp_InsertCustomer_v2", pars, commandType : CommandType.StoredProcedure);

                    return(RepoResponse <int> .Create(pars.Get <int>(nameof(model.Id))));
                }
            }
            catch (Exception e)
            {
                return(RepoResponse <int> .Create(0, GetException(e)));
            }
        }