public async Task UpdateDocumentType_ValidArgument()
        {
            await _documentTypeService.Update(new DocumentType());

            _documentTypeRepositoryMock.Verify(c => c.UpdateAsync(It.IsAny <DocumentType>()), Times.Once);
            _mediatorMock.Verify(c => c.Publish(It.IsAny <EntityUpdated <DocumentType> >(), default), Times.Once);
        }
示例#2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                switch (RowID)
                {
                case 0:
                    DocumentTypeService.Add(
                        txtDescription.Text,
                        chkIsLastState.Checked,
                        ddlCustomerStatus.SelectedValue.ToDefaultNumber <int>());
                    break;

                default:
                    DocumentTypeService.Update(
                        RowID,
                        txtDescription.Text,
                        chkIsLastState.Checked,
                        ddlCustomerStatus.SelectedValue.ToDefaultNumber <int>());
                    break;
                }
                Refresh();
            }
            catch (Exception ex)
            {
                WebFormHelper.SetLabelTextWithCssClass(lblMessage, ex.Message, LabelStyleNames.ErrorMessage);
                LogService.ErrorException(GetType().FullName, ex);
            }
        }
        public async Task <ActionResult> Edit(DocumentTypeViewModel collection)
        {
            try
            {
                collection.ModifiedDate = DateTime.Now;
                var stringContent = new StringContent(JsonConvert.SerializeObject(collection).ToString(), Encoding.UTF8, "application/json");
                var status        = await service.Update(stringContent);

                return(new JsonResult {
                    Data = new { status = status }
                });
            }
            catch
            {
                return(View());
            }
        }
        ///*public ActionResult Edit(int id, FormCollection collection*/)
        public ActionResult Edit(DocumentType documentType)
        {
            if (ModelState.IsValid)
            {
                _service.Update(documentType);
                return(RedirectToAction("Index"));
            }
            return(View(documentType));


            //try
            //{
            //    var documentType = new DocumentType();

            //    documentType.Name = collection["Name"];
            //    _service.Update();

            //    return RedirectToAction("Index");
            //}
            //catch
            //{
            //    return View();
            //}
        }
示例#5
0
 // PUT api/<controller>/5
 public IHttpActionResult Put([FromBody] ITS_DocumentType docType)
 {
     return(Utils.Response(MapService.MapOne <ITS_DocumentType, DocumentTypeDTO>(Service.Update(docType)), HttpStatusCode.NotFound, string.Format("Could not update document type {0}.", docType.DocumentType), Request.RequestUri.AbsoluteUri));
 }
 // PUT: api/DocumentType/5
 public IHttpActionResult Put([FromBody] DocumentType model)
 {
     _service.Update(model);
     return(Ok(model));
 }