コード例 #1
0
            public CallVm MapToCallVm(Call call)
            {
                // Call sınıfında User virtual bir property olduğu için database sorgusunda açıkca include edilmezse
                // call nesnesinde bu property tanımı olmaz ve buna erişmeye çalışıldığında hata fırlatır.
                string userFullName;

                try { userFullName = call.User?.Fullname; }
                catch { userFullName = null; }

                return(call == null ? null : new CallVm {
                    Id = HashidsHelper.Encrypt(call.Id), ContactId = HashidsHelper.Encrypt(call.ContactId), UserId = HashidsHelper.Encrypt(call.UserId), UserFullname = userFullName, IsAccess = call.IsAccess, Date = call.Date
                });
            }
コード例 #2
0
 public ContactVm MapToContactVm(Contact contact)
 {
     return(contact == null ? null : new ContactVm {
         Id = HashidsHelper.Encrypt(contact.Id), Phone = contact.Phone, CallReason = contact.CallReason, CallResult = contact.CallResult, Date = contact.Date
     });
 }
コード例 #3
0
        public ActionResult Create(ContactVm model)
        {
            var contact = _contactService.Add(model.MapTo <Contact>());

            return(Json(new { success = true, message = C.Message.Success, contactId = HashidsHelper.Encrypt(contact.Id) }));
        }