public DiariesBo Create(Diary diary) { if (diary == null) throw new ArgumentNullException("diary"); if (diary.CurrentDate != null) return new DiariesBo() { Url = _urlHelper.Link("Diaries", new { dairyid = diary.CurrentDate.Value.ToString("yyyy-MM-dd") }), CurrentDay = (DateTime)diary.CurrentDate, Username = diary.UserName }; return null; }
public Diary Parse(DiariesBo diariesBo) { try { var diaries = new Diary(); if (diariesBo.CurrentDay!=default(DateTime)) { diaries.CurrentDate = diariesBo.CurrentDay; diaries.UserName = diariesBo.Username; } return diaries; } catch (Exception) { return null; } }