コード例 #1
0
ファイル: BarangFacade.cs プロジェクト: daytch/ljgb
        public async Task <BarangResponse> AddPost(BarangRequest request, string email)
        {
            BarangResponse response = new BarangResponse();

            try
            {
                TypeBarangRequest typeRequest = new TypeBarangRequest();
                typeRequest.ID = request.TypeBarangId;
                var    getTYpe = da_type.GetPost(typeRequest).Result;
                Barang model   = new Barang();
                model.HargaOtr     = request.HargaOtr;
                model.Name         = getTYpe.Model.Name;
                model.WarnaId      = request.WarnaId;
                model.PhotoPath    = request.PhotoPath;
                model.TypeBarangId = request.TypeBarangId;
                model.Created      = DateTime.Now;
                model.CreatedBy    = email;
                model.RowStatus    = true;
                model.KotaId       = request.KotaID.Value;

                var postId = await dep.AddPost(model);

                if (postId > 0)
                {
                    response.Message   = "Data Already Saved";
                    response.IsSuccess = true;
                }
                else
                {
                    response.Message   = "Save Failed";
                    response.IsSuccess = false;
                }
            }
            catch (Exception ex)
            {
                response.Message   = ex.ToString();
                response.IsSuccess = false;
            }
            return(response);
        }
コード例 #2
0
 public async Task <TypeBarangResponse> GetPost(TypeBarangRequest request)
 {
     return(await dep.GetPost(request));
 }